#!/usr/bin/env node
const http=require('https'),
      log=console.log,
    //  url=require('url'),
      cheerio=require('cheerio'),
      addr='https://ke.sifou.com/free',
      baseURL='https://ke.sifou.com'

http.get(addr,(res)=>{
    
    
    
      //res.pipe(process.stdout);//print response body
      //
      let data='';
      res.on('data',(chunk) =>data+=chunk);

      res.on('end',() => {
        let $=cheerio.load(data);
       let coursers= $('body').find('h5.card-title>a');
       for(let i=0;i<coursers.length;i++){
            log($(coursers[i]).text());
            log(baseURL+$(coursers[i]).attr('href'));
            log();
       }

       // log(data);
      })
    



});

